﻿using System;
using UnityEngine;
using UnityEngine.UI;

namespace Studio
{
	// Token: 0x020005B8 RID: 1464
	public class RootButtonCtrl : MonoBehaviour
	{
		// Token: 0x17000484 RID: 1156
		// (set) Token: 0x06002553 RID: 9555 RVA: 0x000DD580 File Offset: 0x000DB780
		public ObjectCtrlInfo objectCtrlInfo
		{
			set
			{
				this.manipulate.manipulatePanelCtrl.objectCtrlInfo = value;
			}
		}

		// Token: 0x17000485 RID: 1157
		// (get) Token: 0x06002554 RID: 9556 RVA: 0x000DD594 File Offset: 0x000DB794
		// (set) Token: 0x06002555 RID: 9557 RVA: 0x000DD59C File Offset: 0x000DB79C
		public int select { get; private set; }

		// Token: 0x06002556 RID: 9558 RVA: 0x000DD5A8 File Offset: 0x000DB7A8
		public void OnClick(int _kind)
		{
			this.select = ((this.select != _kind) ? _kind : -1);
			for (int i = 0; i < this.ciArray.Length; i++)
			{
				this.ciArray[i].active = (i == this.select);
			}
			Singleton<Studio>.Instance.colorPaletteCtrl.visible = false;
		}

		// Token: 0x06002557 RID: 9559 RVA: 0x000DD610 File Offset: 0x000DB810
		private void Start()
		{
			this.select = -1;
			this.ciArray = new RootButtonCtrl.CommonInfo[]
			{
				this.add,
				this.manipulate,
				this.sound,
				this.system
			};
			for (int i = 0; i < this.ciArray.Length; i++)
			{
				this.ciArray[i].canvas = this.canvas;
				this.ciArray[i].active = false;
			}
		}

		// Token: 0x040025C4 RID: 9668
		[SerializeField]
		private RootButtonCtrl.CommonInfo add = new RootButtonCtrl.CommonInfo();

		// Token: 0x040025C5 RID: 9669
		[SerializeField]
		private RootButtonCtrl.ManipulateInfo manipulate = new RootButtonCtrl.ManipulateInfo();

		// Token: 0x040025C6 RID: 9670
		[SerializeField]
		private RootButtonCtrl.CommonInfo sound = new RootButtonCtrl.CommonInfo();

		// Token: 0x040025C7 RID: 9671
		[SerializeField]
		private RootButtonCtrl.CommonInfo system = new RootButtonCtrl.CommonInfo();

		// Token: 0x040025C8 RID: 9672
		[SerializeField]
		private Canvas canvas;

		// Token: 0x040025CA RID: 9674
		private RootButtonCtrl.CommonInfo[] ciArray;

		// Token: 0x020005B9 RID: 1465
		[Serializable]
		private class CommonInfo
		{
			// Token: 0x17000486 RID: 1158
			// (get) Token: 0x06002559 RID: 9561 RVA: 0x000DD698 File Offset: 0x000DB898
			// (set) Token: 0x0600255A RID: 9562 RVA: 0x000DD6A0 File Offset: 0x000DB8A0
			public Canvas canvas { get; set; }

			// Token: 0x17000487 RID: 1159
			// (set) Token: 0x0600255B RID: 9563 RVA: 0x000DD6AC File Offset: 0x000DB8AC
			public virtual bool active
			{
				set
				{
					if (this.objRoot.activeSelf != value)
					{
						this.objRoot.SetActive(value);
						this.select = value;
					}
				}
			}

			// Token: 0x17000488 RID: 1160
			// (set) Token: 0x0600255C RID: 9564 RVA: 0x000DD6D4 File Offset: 0x000DB8D4
			public bool select
			{
				set
				{
					this.button.image.color = ((!value) ? Color.white : Color.green);
					SortCanvas.select = this.canvas;
				}
			}

			// Token: 0x040025CB RID: 9675
			public GameObject objRoot;

			// Token: 0x040025CD RID: 9677
			public Button button;
		}

		// Token: 0x020005BA RID: 1466
		[Serializable]
		private class ManipulateInfo : RootButtonCtrl.CommonInfo
		{
			// Token: 0x17000489 RID: 1161
			// (get) Token: 0x0600255E RID: 9566 RVA: 0x000DD710 File Offset: 0x000DB910
			public ManipulatePanelCtrl manipulatePanelCtrl
			{
				get
				{
					if (this.m_ManipulatePanelCtrl == null)
					{
						this.m_ManipulatePanelCtrl = this.objRoot.GetComponent<ManipulatePanelCtrl>();
					}
					return this.m_ManipulatePanelCtrl;
				}
			}

			// Token: 0x1700048A RID: 1162
			// (set) Token: 0x0600255F RID: 9567 RVA: 0x000DD73C File Offset: 0x000DB93C
			public override bool active
			{
				set
				{
					this.manipulatePanelCtrl.active = value;
					base.select = value;
				}
			}

			// Token: 0x040025CE RID: 9678
			[SerializeField]
			private ManipulatePanelCtrl m_ManipulatePanelCtrl;
		}
	}
}
